package cn.cdiothree.controller;

import cn.cdiothree.dataobject.Carousel;
import cn.cdiothree.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商品轮播图
 * @author cumthing
 */
@RestController
@RequestMapping("/carousel")
public class CarouselController {
    @Autowired
    private CarouselService carouselService;

    /**
     * 上传商品轮播图
     * @param productId
     * @return
     */
    @GetMapping("/image")
    public List<Carousel> findByProductId(Integer productId){
        List<Carousel> carousel = carouselService.findByProductId(productId);
        return carousel;
    }
}
